package com.momoc.mrpc.rpc.message;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @author momoc
 * @version 1.0
 * @className Message
 * @description
 * @date 2022/7/25 4:47 下午
 */
public abstract class Message implements Serializable {


    static Map<Integer,Class> messageClassMap = new HashMap<>();

    public  static <T> Class<T> getMessageClass(int type){
        return messageClassMap.get(type);
    }

    public abstract int getMessageType();
    private int sequenceId;

    public int getSequenceId() {
        return sequenceId;
    }

    public void setSequenceId(int sequenceId) {
        this.sequenceId = sequenceId;
    }

    static {
        messageClassMap.put(0, MRpcRequestMessage.class);
        messageClassMap.put(1, MRpcResponseMessage.class);
    }

}
